 /// @file ExchangePMIBase.h
 /// @brief ExchangePMIBase 
 /// @copyright Copyright (c) 2025  Hefei Jiushao Intelligent Technology Co., Ltd. All rights reserved.
 /// @createtime 2025-04-07

#ifndef EXCHANGECOREPMIBASE_H
#define EXCHANGECOREPMIBASE_H
#include <string>

#define ENUM_TO_STRING_CASE_ALL(enumType, ...)         \
    inline const char* enumType##ToString(enumType v) { \
        switch (v) {                                    \
            __VA_ARGS__                                 \
            default: return "Unknown";                  \
        }                                               \
    }

#define STRINGIFY(x) #x
#define ENUM_CASE(enumType, value) case enumType::value: return STRINGIFY( enumType ## _ ## value );

namespace  AMCAX::Exchange::Core::PMI {

enum class PMIAnnotationType
{
	UnknownType,	 
	Datum,		 
	DatumTarget,	 
	Note,			 
	FlagNote,		 
	NOA,			 
	Roughness,	 
	GDT,			 
	Dimension		 
};

ENUM_TO_STRING_CASE_ALL(
    PMIAnnotationType,
    ENUM_CASE(PMIAnnotationType, UnknownType)
    ENUM_CASE(PMIAnnotationType,    Datum)
    ENUM_CASE(PMIAnnotationType,	DatumTarget)
    ENUM_CASE(PMIAnnotationType,	Note)
    ENUM_CASE(PMIAnnotationType,	FlagNote)
    ENUM_CASE(PMIAnnotationType,	NOA)
    ENUM_CASE(PMIAnnotationType,	Roughness)
    ENUM_CASE(PMIAnnotationType,	GDT)
    ENUM_CASE(PMIAnnotationType,	Dimension)
)

class ExchangePMIBase {
public:
    virtual ~ExchangePMIBase() = default;
    void SetName(const std::string &n){
        this->name = n ; 
    } ;

    void SetId(const std::string &i){
        this->id = i ; 
    } ;
    void SetIsHide(bool hide){
        this->isHide = hide ; 
    } ;

    const std::string& GetName() const {
        return name;
    }

    const std::string& GetId() const {
        return id;
    }

    bool GetIsHide() const {
        return isHide;
    }
    virtual std::string ToString() ;
protected:
    std::string name ;
    std::string id ;
    bool isHide = false;
} ;

class ExchangePMIAnnotation : public ExchangePMIBase
{
public:
    virtual ~ExchangePMIAnnotation() = default;

    virtual PMIAnnotationType GetType() const = 0;
} ;

class  ExchangePMIText {

public:
    void SetUpperText(std::string upperText){
        this->upperText = upperText ; 
    } ;

    void SetLowerText(std::string lowerText){
        this->lowerText = lowerText ; 
    } ;

    void SetBeforeText(std::string beforeText){
        this->beforeText = beforeText ; 
    } ;

    void SetAfterText(std::string afterText){
        this->afterText = afterText ; 
    } ;

    void SetPrefixText(std::string prefixText){
        this->prefixText = prefixText ; 
    } ;
    
    void SetSuffixText(std::string suffixText){
        this->suffixText = suffixText ; 
    } ;

    void SetBelowText(std::string belowText){
        this->belowText = belowText ; 
    } ;
    const std::string& GetUpperText() const {
        return upperText;
    }

    const std::string& GetLowerText() const {
        return lowerText;
    }

    const std::string& GetBeforeText() const {
        return beforeText;
    }

    const std::string& GetAfterText() const {
        return afterText;
    }

    const std::string& GetPrefixText() const {
        return prefixText;
    }

    const std::string& GetSuffixText() const {
        return suffixText;
    }

    const std::string& GetBelowText() const {
        return belowText;
    }
    
    std::string ToString() ;
private:
    std::string upperText ;
    std::string lowerText ;
    std::string beforeText ;
    std::string afterText ;
    std::string prefixText ;
    std::string suffixText ;
    std::string belowText ;
} ;

}

#endif